<!DOCTYPE html>
<html>
	<head>
		<title>testTryCatch</title>
		<script type="text/javascript" src="js/jquery-1.8.3.js"></script>
		<script type="text/javascript" src="js/EventUtil.js"></script>
	</head>
	<body>
		<script type="text/javascript">
			/*
			try{
				window.somNonexistentFunction();
			}
			catch(error){
			
				alert('We have catch a error\n'+error);
				
				alert('name:'+error.name);
				
				alert('message:'+error.message);
				
			}
			finally{
				alert('fianlly');
			}
			
			try{
				throw new TypeError('something bad happened!');
			}
			catch(error){
			
				alert('We have catch a error\n'+error);
				
				alert('name:'+error.name);
				
				alert('message:'+error.message);
				
			}
			*/
			
			function CustomError(msg){
				this.name = 'CustomeError';
				this.message = msg;
			}
			//extend Error;
			CustomError.prototype = new Error();
			
			try{
				throw new CustomError('something bad happened!');
			}
			catch(error){
			
				alert('We have catch a error\n'+error);
				
				alert('name:'+error.name);
				
				alert('message:'+error.message);
				
			}
			
		</script>
	</body>
</html>